package cn.fansunion.concurrent.threadabc;

//有3个线程ABC。按照ABC来运行（A线程输出A，B线程输出B，C线程输出C，以此类推，循环输出）。
public class ThreadABCTest1 {

	public static void main(String[] args) {
		for(int index=0;index<3;index++){
			Thread aThread = new Thread(new Runnable(){

				@Override
				public void run() {
					System.out.println("A");
					
				}
				
			});
			aThread.start();
			try {
				aThread.join();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
			Thread bThread = new Thread(new Runnable(){

				@Override
				public void run() {
					System.out.println("B");
					
				}
				
			});
			bThread.start();
			try {
				bThread.join();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
			Thread cThread = new Thread(new Runnable(){

				@Override
				public void run() {
					System.out.println("C");
					
				}
				
			});
			cThread.start();
			try {
				cThread.join();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}

	}

}
